<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function check1(){
				let reg=/^[A-z]\w{2,14}$///必须以字母开头
				let username = document.getElementById("username").value
				if(reg.test(username)){
					document.getElementById("note1").innerHTML="ok"//改文本改属性
				}else{
					document.getElementById("note1").innerHTML="error"
				}
			}
			function check2(){
				let reg=/^1\d{10}$///必须以1开头
				let mphone = document.getElementById("mphone").value
				if(reg.test(mphone)){
					document.getElementById("note2").innerHTML="ok"//改文本改属性
				}else{
					document.getElementById("note2").innerHTML="error"
				}
				}
			function check3(){
				let reg=/(^0\d{2}-?\d{8}$)|(^0\d{3}-?\d{7}$)/
				let tphone = document.getElementById("tphone").value
				if(reg.test(tphone)){
					document.getElementById("note3").innerHTML="ok"//改文本改属性
				}else{
					document.getElementById("note3").innerHTML="error"
				}
				}
			function check4(){
				let reg=/(^([1-9]\d{0,14})|0)(\.\d{1,2})$///整数部分以及小数部分
				let money = document.getElementById("money").value
				if(reg.test(money)){
					document.getElementById("note4").innerHTML="ok"//改文本改属性
				}else{
					document.getElementById("note4").innerHTML="error"
				}
				}
		</script>
	</head>
	<body>
		输入用户昵称:<input type="text" name="" id="username" value="" /> 
		<button type="button" onclick="check1()">检测</button>
		<span id = "note1"></span>
		<br>
		输入手机号码:<input type="text" name="" id="mphone" value="" /> 
		<button type="button" onclick="check2()">检测</button>
		<span id = "note2"></span>
		<br>
		输入座机号码:<input type="text" name="" id="tphone" value="" /> 
		<button type="button" onclick="check3()">检测</button>
		<span id = "note3"></span>
		<br>
		输入存款金额:<input type="text" name="" id="money" value="" /> 
		<button type="button" onclick="check4()">检测</button>
		<span id = "note4"></span>
		<br>
	</body>
</html>
